package com.message.model;

import java.util.List;

public class MessageService {

	private MessageInterface dao;

	public MessageService() {
		dao = new MessageDAO();
	}

	public MessageVO addMessage(String member_id, String msg_content, String driver_path_id, String rider_path_id) {

		MessageVO messageVO = new MessageVO();
		messageVO.setMember_id(member_id);
		messageVO.setMsg_content(msg_content);
		messageVO.setDriver_path_id(driver_path_id);
		messageVO.setRider_path_id(rider_path_id);
		dao.insert(messageVO);

		return messageVO;
	}

	public MessageVO updateMessage(String msg_id, String msg_content, String driver_path_id, String rider_path_id) {

		MessageVO messageVO = new MessageVO();
		messageVO.setMsg_id(msg_id);
		messageVO.setMsg_content(msg_content);
		messageVO.setDriver_path_id(driver_path_id);
		messageVO.setRider_path_id(rider_path_id);

		dao.update(messageVO);

		return messageVO;
	}

	public void deleteMessageNo(String message_id) {
		dao.delete(message_id);
	}

	public MessageVO getOneMessage(String message_id) {
		return dao.findByPrimaryKey(message_id);
	}

	public List<MessageVO> getAll() {
		return dao.getAll();
	}
	
	
	
	
	public List<MessageVO> getDriverOnes(String driver_path_id) {
		return dao.getDriverOnes(driver_path_id);
	}	
	public List<MessageVO> getRiderOnes(String rider_path_id) {
		return dao.getDriverOnes(rider_path_id);
	}	
	public List<MessageVO> getDriverAll() {
		return dao.getDriverAll();
	}
	public List<MessageVO> getRiderAll() {
		return dao.getRiderAll();
	}	
	public List<MessageVO> getDriverAndRider(String driver_path_id, String rider_path_id) {
		return dao.getDriverAndRider(driver_path_id, rider_path_id);
	}
	
}